<template>
	<view>
		<view class="mh-form">

			<view class="mh-form-card">
				<view class="mh-form-item border">
					<view class="mh-form-item-label width-140">
						原密码：
					</view>
					<u-input v-model="formData.oldPassword" placeholder="原密码" height="40"></u-input>
				</view>
				<view class="mh-form-item border">
					<view class="mh-form-item-label width-140">
						新密码：
					</view>
					<u-input v-model="formData.password" placeholder="新密码" height="40"></u-input>
				</view>
				<view class="mh-form-item border">
					<view class="mh-form-item-label width-140">
						确认密码：
					</view>
					<u-input v-model="formData.confirmPwd" placeholder="确认密码" height="40"></u-input>
				</view>
			</view>

			<view class="" style="padding: 80rpx 0;">
				<u-button type="primary" @click="modifyPassword()">修改</u-button>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				formData: {

				},
			}
		},
		onLoad() {

		},
		methods: {

			modifyPassword() {
				if (!this.formData.oldPassword) {
					this.$u.toast('请输入原密码')
					return false
				}
				if (!this.formData.password) {
					this.$u.toast('请输入新密码')
					return false
				}
				if (!this.formData.confirmPwd) {
					this.$u.toast('请输入确认密码')
					return false
				}
				this.$u.api.modifyPassword(this.formData).then(res => {
					this.$u.toast('修改成功!')
					setTimeout(() => {
						uni.navigateBack()
					}, 1500)
				})
			},

		}
	}
</script>
<style>
	page {
		background-color: #F5F7FA;
	}
</style>
<style lang="scss" scoped>
	.nav-right {
		font-weight: 500;
		font-size: 32rpx;
		color: #FFFFFF;
		line-height: 45rpx;
		margin-right: 45rpx;
	}
</style>